package org.sbbs.app.demo.webapp.action;

import javax.servlet.http.HttpServletRequest;

import org.sbbs.app.demo.service.DemoEntityManager;
import org.sbbs.base.search.PropertySearchBuilder;
import org.sbbs.base.webapp.action.BaseGridAction;

import com.googlecode.genericdao.search.Search;
import com.googlecode.genericdao.search.SearchResult;


public class DemoDwzPagedAction
    extends BaseGridAction {
    private DemoEntityManager demoEntityManager;

    public String gridPageList() {
        HttpServletRequest req = this.getRequest();
        Search search = PropertySearchBuilder.BuildSearch( getRequest() );
        SearchResult srt = this.demoEntityManager.searchAndCount( search );

        this.setPageList( srt.getResult() );
        this.records = srt.getTotalCount();
        this.total = getTotlePage( records, search.getMaxResults() );
        this.page = search.getPage() + 1;

        return this.SUCCESS;
    }

    public DemoEntityManager getDemoEntityManager() {
        return demoEntityManager;
    }

    public void setDemoEntityManager( DemoEntityManager demoEntityManager ) {
        this.demoEntityManager = demoEntityManager;
    }


}
